package com.eastfair.venueservice.service;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.eastfair.boot.request.PageParams;
import com.eastfair.builder.dto.ExhibitorDTO;
import com.eastfair.home.dto.ReportSpaceAuditDTO;
import com.eastfair.venueservice.dto.ExhibitionSettlementDTO;
import com.eastfair.venueservice.dto.ServiceOrderDTO;
import com.eastfair.venueservice.entity.ServiceOrder;
import com.eastfair.venueservice.vo.ExhibitionSettlementVO;
import com.eastfair.venueservice.vo.ServiceOrderVO;

import java.util.List;

/**
 * 主场，搭建商 的服务订单 Service.
 *
 * @author dqq
 * @date 2022 /11/10
 */
public interface HomeServiceOrderService {

    /**
     * 分页查询服务订单列表.
     *
     * @param pageParams the page params
     * @return the page
     */
    Page<ServiceOrderVO> listServiceOrderVOs(PageParams<ServiceOrderDTO> pageParams);

    /**
     * 展商ID列表查询管理费订单
     *
     * @param exhibitorIdList the exhibitor id list
     * @return the list
     */
    List<ServiceOrderVO> listManageVOByExhibitorIdList(List<Long> exhibitorIdList);

    /**
     * 展商展位ID查询订单列表.
     *
     * @param exhibitorId the exhibitor id
     * @return the list
     */
    List<ServiceOrderVO> listOrderVOByExhibitorId(Long exhibitorId);

    /**
     * 查询需结算的主场服务订单与管理费订单
     *
     * 主场保证金订单取消之后不统计到结算单中
     *
     * @param query the query
     * @return the list
     */
    List<ServiceOrderVO> listForHomeServiceOrderSettlement(ServiceOrderDTO query);

    List<ServiceOrderVO> listForVenueServiceOrderSettlement(ServiceOrderDTO query);

    /**
     * 获取主场服务与管理费结算单
     * <p>
     * 不需要
     * 未提交的订单
     * 已取消的订单
     *
     * @param query the query
     * @return the repair settlement by exhibition id
     */
    ExhibitionSettlementVO getHomeServiceOrderSettlement(ExhibitionSettlementDTO query);

    ExhibitionSettlementVO getVenueServiceOrderSettlement(ExhibitionSettlementDTO query);


    /**
     * 展商ID查询管理费订单列表
     *
     * @param exhibitorId the exhibitor id
     * @return the list
     */
    List<ServiceOrder> listManageOrderByExhibitorId(Long exhibitorId);

    /**
     * 校验展位的管理费是否唯一
     *
     * @param query the query
     * @return the boolean
     */
    boolean checkSiteManageOrderUnique(ServiceOrderDTO query);

    /**
     * 订单编号获取服务订单VO.
     *
     * @param orderNumber the order number
     * @return the vo by order number
     */
    ServiceOrderVO getVOByOrderNumber(String orderNumber);

    /**
     * 保存搭建商服务订单.
     *
     * @param serviceOrderDTO the service order dto
     * @return the boolean
     */
    ServiceOrder saveServiceOrderForBuilder(ServiceOrderDTO serviceOrderDTO);

    /**
     * 保存搭建商管理费订单.
     *
     * @param serviceOrderDTO the service order dto
     * @return the service order
     */
    ServiceOrder saveManageExpenseOrderForBuilder(ServiceOrderDTO serviceOrderDTO);

    /**
     * 保存搭建商服务订单与管理费订单.
     *
     * @param serviceOrderDTO the service order dto
     * @return the list
     */
    List<ServiceOrder> saveOrderForBuilder(ServiceOrderDTO serviceOrderDTO);

    /**
     * 主场报馆审核记录生成服务订单.
     *
     * @param reportSpaceAuditDTO the report space audit
     * @return the service order
     */
    ServiceOrder saveServiceOrderByReportSpaceAudit(ReportSpaceAuditDTO reportSpaceAuditDTO);

    /**
     * 主场报馆审核记录生成管理费订单.
     *
     * @param reportSpaceAuditDTO the report space audit
     * @return the service order
     */
    ServiceOrder saveManageExpenseOrderByReportSpaceAudit(ReportSpaceAuditDTO reportSpaceAuditDTO);

    /**
     * 主场报馆审核通过生成订单.
     *
     * @param reportSpaceAuditDTO the report space audit
     * @return the boolean
     */
    List<ServiceOrder> saveOrderForReportSpace(ReportSpaceAuditDTO reportSpaceAuditDTO);

    /**
     * 更新订单.
     *
     * @param serviceOrderDTO the service order dto
     * @return the boolean
     */
    ServiceOrder updateServiceOrder(ServiceOrderDTO serviceOrderDTO);

    /**
     * 提交订单.
     *
     * @param orderNumber order number
     * @return the boolean
     */
    boolean submitServiceOrder(String orderNumber);

    /**
     * 批量提交订单.
     *
     * @param orderNumberList the order number list
     * @return the boolean
     */
    boolean submitServiceOrder(List<String> orderNumberList);

    /**
     * 生成支付系统交易订单.
     *
     * @param orderNumber the order number
     * @return the boolean
     */
    boolean saveTransactionOrder(String orderNumber);

    /**
     * 为支付订单补全字段.
     *
     * @param serviceOrder the service order
     * @return the service order dto
     */
    ServiceOrderDTO completeForTransactionOrder(ServiceOrder serviceOrder);

    /**
     * 取消订单.
     *
     * @param orderNumber the order number
     * @return the boolean
     */
    boolean cancelServiceOrder(String orderNumber);

    /**
     * 超时未支付取消订单.
     *
     * @param orderNumber the order number
     * @return the boolean
     */
    boolean cancelTimeoutNotPayServiceOrder(String orderNumber);

    /**
     * 订单编号更新订单为取消.
     *
     * @param orderNumber the order number
     * @return the service order
     */
    ServiceOrder updateOrderStatusCancel(String orderNumber);

    /**
     * 发起退款申请.
     *
     * @param serviceOrderDTO the service order
     * @return the boolean
     */
    boolean applyServiceOrderRefund(ServiceOrderDTO serviceOrderDTO);

    /**
     * 更新订单状态为已完成.
     *
     * @param serviceOrder the service order
     * @return the boolean
     */
    boolean updateOrderStatusComplete(ServiceOrder serviceOrder);

    /**
     * 更新搭建商订单状态为部分报馆.
     *
     * @param orderNumber the order number
     * @return the boolean
     */
    boolean updateOrderStatusPartialReportVenue(String orderNumber);

    /**
     * 更新搭建商订单状态为已报馆.
     *
     * @param orderNumber the order number
     * @return the boolean
     */
    boolean updateOrderStatusHasReportVenue(String orderNumber);

    /**
     * 更新搭建商订单服务报馆状态
     *
     * @param orderNumber the order number
     * @return boolean
     */
    boolean updateServiceReportVenueStatus(ServiceOrder orderNumber);

    /**
     * 更新搭建商订单是否需要报馆.
     *
     * @param orderNumber the order number
     * @return the boolean
     */
    boolean updateIsNeedReportVenue(String orderNumber);

    /**
     * 支付订单.
     *
     * @param serviceOrderDTO the service order dto
     * @return the boolean
     */
    boolean payServiceOrder(ServiceOrderDTO serviceOrderDTO);

    /**
     * 发送配置收款商户的站内信.
     *
     * @param serviceOrder the service order
     * @return the r
     */
    boolean sendConfigPayeeInnerMsg(ServiceOrderDTO serviceOrder);

    /**
     * 异步发送配置收款商户的站内信.
     *
     * @param serviceOrder the service order
     */
    void asyncSendConfigPayeeInnerMsg(ServiceOrderDTO serviceOrder);
}